import 'package:flutter/material.dart';

///禁用效果容器
class EnableContainer extends StatelessWidget {
  final bool enable;
  final Widget? child;
  const EnableContainer({super.key, this.enable = true, this.child});

  @override
  Widget build(BuildContext context) {
    return Stack(
      alignment: Alignment.center,
      children: [
        if (child != null) child!,
        Visibility(
            visible: !enable, //禁止操作效果，盖一层半透明在顶部
            child: Container(
              color: Colors.black.withOpacity(0.5),
            ))
      ],
    );
  }
}
